home *** CD-ROM | disk | FTP | other *** search
- /*
- * WINUTIL.C A set of useful Windows utility functions for KEYMAP
- * Copyright (c) 1991 by William S. Hall and Peter Belew
- */
-
- #define NOCOMM
- #define NOKANJI
- #define NOSOUND
- #include <windows.h>
- #include <stdarg.h>
- #include <stdio.h>
- #include "winutils.h"
-
- /*
- * This function replaces printf and sends output to the AUX device
- * To use this function you must load the device driver OX.SYS
- * Do NOT run Windows with redirection to AUX.
- * Use dbs just like printf
- * Example dbs("function foo %d %s, myint, mystring);
- */
- void FAR _cdecl dbs(const char *fmt, ...)
- {
- char buf[255];
-
- va_list arg_ptr;
-
- va_start(arg_ptr, fmt);
- vsprintf(buf, fmt, arg_ptr);
- va_end(arg_ptr);
-
- OutputDebugString(buf);
-
- }
-
- /* opens a modal dialog box */
- int FAR OpenDlgBox(HWND hWnd, FARPROC fpProc, WORD boxnum)
- {
-
- FARPROC fp;
- int result;
- HANDLE hInst = GetWindowWord(hWnd, GWW_HINSTANCE);
-
- /* make a proc instance for the about box window function */
- fp = MakeProcInstance(fpProc, hInst);
- /* create a modal dialog box */
- result = DialogBox(hInst, MAKEINTRESOURCE(boxnum), hWnd, fp);
- FreeProcInstance(fp);
- return result;
-
- }
-
- /* opens a modal dialog box with parameters */
- int FAR OpenDlgBoxParam(HWND hWnd, FARPROC fpProc, WORD boxnum, LONG lParam)
- {
-
- FARPROC fp;
- int result;
- HANDLE hInst = GetWindowWord(hWnd, GWW_HINSTANCE);
-
- /* make a proc instance for the about box window function */
- fp = MakeProcInstance(fpProc, hInst);
- /* create a modal dialog box */
- result = DialogBoxParam(hInst, MAKEINTRESOURCE(boxnum), hWnd, fp, lParam);
- FreeProcInstance(fp);
- return result;
-
- }
-